package com.procurement.inquiry.service.impl;

import com.procurement.inquiry.domain.PcmMaterialPrice;
import com.procurement.inquiry.domain.PcmSupplierQuo;
import com.procurement.inquiry.domain.ProductNumber;
import com.procurement.inquiry.mapper.PcmCheckMapper;
import com.procurement.inquiry.service.PcmCheckService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.PcmSupplierQuotation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class PcmCheckServiceImpl implements PcmCheckService {
    @Autowired
    private PcmCheckMapper pcmCheckMapper;
    @Override
    public List<PcmSupplierQuo> PcmSupplierQuotationList(String inquiryDemandNumber) {
        return pcmCheckMapper.PcmSupplierQuotationList(inquiryDemandNumber);
    }

    @Override
    public int insertPcmMaterialPrice(List<PcmMaterialPrice> pcmMaterialPrice) {

        pcmMaterialPrice.forEach(e->{
            e.setSubmissionTime(new Date());
            Long userId= SecurityUtils.getUserId();
            e.setSubmitter(userId);
            pcmCheckMapper.insertPcmMaterialPrice(e);
        });
        return 1;
    }

    @Override
    public List<ProductNumber> selectProductNumber() {
        return pcmCheckMapper.selectProductNumber();
    }

    @Override
    public List<PcmSupplierQuotation> selectPcmSupplierQuotation() {
        return pcmCheckMapper.selectPcmSupplierQuotation();
    }

    @Override
    public List<PcmSupplierQuo> selectInquiry() {
        return pcmCheckMapper.selectInquriy();
    }

    @Override
    public List<PcmSupplierQuo> selectProductNumber2() {
        return pcmCheckMapper.selectProductNumber2();
    }

    @Override
    public List<PcmSupplierQuo> selectProductName() {
        return pcmCheckMapper.selectProductName();
    }

    @Override
    public List<PcmSupplierQuo> selectSupplier() {
        return pcmCheckMapper.selectSupplier();
    }
}
